$OpenBSD: patch-SConstruct,v 1.5 2016/08/01 18:31:29 bentley Exp $
--- SConstruct.orig	Sun Jul 31 20:35:51 2016
+++ SConstruct	Sun Jul 31 20:36:16 2016
@@ -128,9 +128,6 @@ else:
     env.Append(CPPDEFINES=["_GTK3"])
     env.Append(CCFLAGS = ["-D_GTK"])
 
-  ### Just make every configuration use -ldl, it may be needed for some reason.
-  env.Append(LIBS = ["-ldl"])
-
   ### Lua platform defines
   ### Applies to all files even though only lua needs it, but should be ok
   if env['LUA']:
@@ -144,9 +141,9 @@ else:
       env.Append(CCFLAGS = ["-DLUA_USE_LINUX"])
     lua_available = False
     if env['SYSTEM_LUA']:
-      if conf.CheckLib('lua5.1'):
-        env.Append(LINKFLAGS = ["-llua5.1"])
-        env.Append(CCFLAGS = ["-I/usr/include/lua5.1"])
+      if conf.CheckLib('${MODLUA_WANTLIB}'):
+        env.Append(LINKFLAGS = ["${MODLUA_LIB}"])
+        env.Append(CCFLAGS = ["-I${MODLUA_INCL_DIR}"])
         lua_available = True
       elif conf.CheckLib('lua'):
         env.Append(LINKFLAGS = ["-llua"])
@@ -184,11 +181,6 @@ if env['FRAMESKIP']:
 print "base CPPDEFINES:",env['CPPDEFINES']
 print "base CCFLAGS:",env['CCFLAGS']
 
-if env['DEBUG']:
-  env.Append(CPPDEFINES=["_DEBUG"], CCFLAGS = ['-g', '-O0'])
-else:
-  env.Append(CCFLAGS = ['-O2'])
-
 if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI']:
   env.Append(CPPDEFINES=["CREATE_AVI"])
 else:
@@ -237,5 +229,5 @@ env.InstallAs(prefix + '/share/fceux/', share_src)
 env.Install(prefix + '/share/fceux/', auxlib_src)
 env.Install(prefix + '/share/pixmaps/', image_src)
 env.Install(prefix + '/share/applications/', desktop_src)
-env.Install(prefix + "/share/man/man6/", [man_src, man_net_src])
+env.Install(prefix + "/man/man6/", [man_src, man_net_src])
 env.Alias('install', prefix)
